﻿
using System.Drawing;
using System.Linq;

namespace FinalTest_Algonrithm
{
    /// <summary>
    /// 转换关系，把算法参数统一
    /// </summary>
    public class AlgChangeHelper
    {
        //chart 类型
       
        public static bool Chart_SZSFRResult(double[] listValue, ref SFRValue sfr, ref RectInfo rect)
        {

            if (listValue.Length < 35)
                return false;
            sfr = new SFRValue();
            sfr.block = new BlockValue[13];
            for (int i = 0; i < 13; i++)
            {
                sfr.block[i] = new BlockValue();
                sfr.block[i].aryValue = new double[5];
            }

            rect = new RectInfo();
            #region 
            rect.Points = new Point[13][];
            for (int i = 0; i < 13; i++)
            {
                rect.Points[i] = new Point[5];
                for (int j = 0; j < 5; j++)
                {
                    rect.Points[i][j] = new Point();
                }
            }

            #endregion

            int index = 0;
            for (int i = 0; i < 5; i++)
            {
                rect.Points[i][0].X = (int)listValue[7 * index + 0];
                rect.Points[i][0].Y = (int)listValue[7 * index + 1];
                sfr.block[i].aryValue[0] = -1;
                sfr.block[i].aryValue[1] = listValue[7 * index + 2];
                sfr.block[i].aryValue[2] = listValue[7 * index + 3];
                sfr.block[i].aryValue[3] = listValue[7 * index + 4];
                sfr.block[i].aryValue[4] = listValue[7 * index + 5];
                sfr.block[i].dValue = listValue[7 * index + 6];
                sfr.block[i].dX = listValue[7 * index + 0];
                sfr.block[i].dY = listValue[7 * index + 1];
                index++;
            }
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    rect.Points[i][j + 1].X = (int)listValue[4 * i + 0 + 35 + j];
                    rect.Points[i][j + 1].Y = (int)listValue[4 * i + 20 + 35 + j];
                }
            }
            return true;
        }

    }

}
